from research.calcor import calcor_base
from research.calcor.calcor_logic import logic_calc
class continuityN():
    def __init__(self,logic):#feild
        self.timekey=None
        self.logic=logic
        self.rst=0
        self.prerstt=0
        self.iscon=False
    def oncalc(self,b,timekey=None):
        r0 = 0
        r = logic_calc(self.logic, b)
        if r==True:
            r0 = 1
            self.iscon=True
        else:
            self.iscon = False

        if timekey:
            if self.timekey == self.timekey:
                self.rst = self.prerstt+r0
            else:
                if self.iscon:
                    self.rst = self.prerstt + r0
                else:
                    self.rst = 0
                self.prerstt=self.rst
            self.timekey = timekey
        else:
            if self.iscon:
                self.rst=self.rst+r0
            else:
                self.rst=0
        return self.rst

if __name__=="__main__":
    pass